import request from '@/utils/request'

const api = {
  getKpiUnitUrl: '/kpi_config/get_kpiunit',
  getKpiProcessUrl: '/kpi_report/get_kpi_process',
  getUserByPkUrl: '/kpi_report/get_user_bypk',
  updateKpiQuotaUrl: '/kpi_operation/update_kpi_quota',
  getKpiForMonthUrl: '/kpi_operation/get_kpi_for_month',
  reGetDingeUrl: '/kpi_operation/re_getdinge',
  calcKpiUrl: '/kpi_operation/calc_kpi',
  matchQuotaUrl: '/kpi_operation/match_quota',
  lookforWeitinghuanUrl: '/kpi_operation/lookfor_weitinghuan',
  calcSurplusTimeUrl: '/kpi_operation/calc_surplus_time',
  calKpiUrl: '/kpi_operation/calc_kpi_onefa',
  calQuotaUrl: '/kpi_operation/match_quota_onefa',
  calteWeiTinghuanUrl: '/kpi_operation/lookfor_weitinghuan_onefa',
  calteFzQmsUrl: '/kpi_operation/fz_qms_onefa',
  calSurplusUrl: '/kpi_operation/calc_surplus_time_onefa',
  fzQmsUrl: '/kpi_operation/fz_qms',
}
export async function fzQmsApi(params: Map<string, any>) {
  const res = await request({
    url: api.fzQmsUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}

export async function calcSurplusTimeApi(params: Map<string, any>) {
  const res = await request({
    url: api.calcSurplusTimeUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function lookforWeitinghuanApi(params: Map<string, any>) {
  const res = await request({
    url: api.lookforWeitinghuanUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}

export async function matchQuotaApi(params: Map<string, any>) {
  const res = await request({
    url: api.matchQuotaUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}

export async function calcKpiApi(params: Map<string, any>) {
  const res = await request({
    url: api.calcKpiUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}

export async function reGetDinge(params: Map<string, any>) {
  const res = await request({
    url: api.reGetDingeUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function getKpiForMonthApi(params: Map<string, any>) {
  const res = await request({
    url: api.getKpiForMonthUrl,
    method: 'post',
    data: params,
  })
  return res
}
export async function updateKpiQuotaApi(params: Map<string, any>) {
  const res = await request({
    url: api.updateKpiQuotaUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function getUserByPkApi(params: Map<string, any>) {
  const res = await request({
    url: api.getUserByPkUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function getKpiProcessApi(params: Map<string, any>) {
  const res = await request({
    url: api.getKpiProcessUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function getKpiUnitApi(params: Map<string, any>) {
  const res = await request({
    url: api.getKpiUnitUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function calKpi(params: Map<string, any>) {
  const res = await request({
    url: api.calKpiUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}
export async function calQuota(params: Map<string, any>) {
  const res = await request({
    url: api.calQuotaUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}

export async function calteWeiTinghuan(params: Map<string, any>) {
  const res = await request({
    url: api.calteWeiTinghuanUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}
export async function calteFzQms(params: Map<string, any>) {
  const res = await request({
    url: api.calteFzQmsUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}
export async function calSurplus(params: Map<string, any>) {
  const res = await request({
    url: api.calSurplusUrl,
    method: 'get',
    params: params,
    timeout: 300000,
  })
  return res
}
